#!/bin/bash

echo "链家爬虫MongoDB版启动脚本"
echo "============================================="
echo "注意：请确保已安装并启动MongoDB服务"
echo

echo "正在编译和打包项目..."
mvn clean package

if [ $? -ne 0 ]; then
    echo "编译失败，请检查错误信息"
    exit 1
fi

echo
echo "编译成功，开始运行爬虫程序..."
echo "您将被询问是否下载图片（默认不下载）和是否重建MongoDB集合（默认不重建）"
echo
java -Xmx2g -jar target/crawler-1.0-SNAPSHOT-jar-with-dependencies.jar com.lianjia.crawler.MongoDBCrawler

echo "爬虫程序执行完毕" 